async function showModal(url, params, options) {
    let dialogOptions = {
        width: 1000,
        height: 600,
        left: '2%',
        top: '2%',
        resizable: true,
        extStyle: ''
    }
    $.extend(dialogOptions, options);
    let pWidth = window.innerWidth
    let pHeight = window.innerHeight
    if(pWidth > dialogOptions.width){
        dialogOptions.left = (pWidth - dialogOptions.width)/2 + 'px'
    }
    if(pHeight > dialogOptions.height){
        dialogOptions.top = (pHeight -dialogOptions.height)/2 + 'px'
    }
    let styles = 'border-width: 1px;overflow: hidden;padding:0px;margin:0px;background:none;'
    styles = styles + 'width:' + dialogOptions.width + 'px;'
    styles = styles + 'height:' + dialogOptions.height + 'px;'
    styles = styles + 'top:' + dialogOptions.top + ';'
    styles = styles + 'left:' + dialogOptions.left + ';'
    styles = styles + dialogOptions.extStyle;
    let res = await window.showModalDialog(url, params, styles,dialogOptions.resizable);
    return res;
}

function closeModal(){
   let dialog =  window.parent.document.getElementById('dialog')
   dialog.close();
}